package
{
	import mx.controls.*;
	import mx.rpc.events.*;
	
	public class SimpleCall implements IStrategy
	{
		private var ui:DruplexEngine;
		
		[Bindable] private var testResult:Array;
		private var apiKey:String = "";
		private var sessionID:String;
		private var currentUser:String;
		private var userRole:String;
		
		////////////////////////////////////////////////////////////////////////////////
		//
		// IStrategy API
		//
		////////////////////////////////////////////////////////////////////////////////
		
		public function execute(ui:DruplexEngine):void
		{
			this.ui = ui;
			start();
		}
		
		public function onSystemConnect(event:ResultEvent):void
		{
			sessionID = event.result.sessid;
			currentUser = event.result.user.name;
			
			getAllReferences();
		}
		
		////////////////////////////////////////////////////////////////////////////////
		//
		// PROTECTED
		//
		////////////////////////////////////////////////////////////////////////////////
		
		protected function start():void
		{
			ui.system.connect();
			
		}
		
		protected function getAllReferences():void
		{
			//ui.views.get(apiKey, "testview", ["nid", "title", "body"]);
			ui.views.get(apiKey, "testview");
		}
	}
}